package com.ruoyi.publish.service.impl;

import com.ruoyi.publish.domain.Article;
import com.ruoyi.publish.mapper.ArticleMapper;
import com.ruoyi.publish.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ArticleServiceImpl implements ArticleService {
    @Autowired
    private ArticleMapper articleMapper;
    @Override
    public List<Article> selectList(Article article) {
        return articleMapper.selectList(article);
    }

    @Override
    public boolean checkAticleNameUnique(Article article) {
        return articleMapper.checkArticleNameUnique(article) == 0;
    }

    @Override
    public boolean checkColumnExists(Long columnId) {
        return articleMapper.checkColumnExists(columnId)>0;
    }

    @Override
    public int insertArticle(Article article) {
        return articleMapper.insertArticle(article);
    }

    @Override
    public int updateArticle(Article article) {
        return articleMapper.updateArticle(article);
    }

    @Override
    public boolean checkArticleExists(Long articleId) {
        return articleMapper.checkArticleExists(articleId)>0;
    }

    @Override
    public int deleteArticleById(Long articleId) {
        return articleMapper.deleteArticleById(articleId);
    }

    @Override
    public int updateStatus(Article article) {
        return articleMapper.updateStatus(article);
    }

    @Override
    public List<Map<String,Object>> selectColumnName() {
        return articleMapper.selectColumnName();
    }

    @Override
    public Article selectArticleById(Long articleId) {
        return articleMapper.selectArticleById(articleId);
    }

    @Override
    public boolean checkArticleCanRecall(Long articleId) {
        return articleMapper.checkArticleCanRecall(articleId);
    }

}
